<caltech-header title="Calibration Certificate" page="1">
    <h3>CERTIFICATE OF CALIBRATION</h3>
    <h5 ng-show="model.certificateNo">Report No. {{model.certificateNo}}</h5>
</caltech-header>

<div class="certificate-item">
    <div class="pull-right-print">
        <div class="row">
            <div class="col-xs-2">
                <label>Manufacturer:</label>
            </div>
            <div class="col-xs-5">
                <a href="#" editable-text="model.manufacturer" buttons="no" blur="submit" e-name="manufacturer">{{model.manufacturer}}</a>
            </div>
            <div class="col-xs-2">
                <label>Work order #:</label>
            </div>
            <div class="col-xs-3">
                <a href="#" editable-text="model.workOrderNo" buttons="no" blur="submit" e-name="workOrderNo">{{model.workOrderNo}}</a>
            </div>
        </div>
        <div class="row">
            <div class="col-xs-2">
                <label>Description:</label>
            </div>
            <div class="col-xs-5">
                <a href="#" editable-text="model.description" buttons="no" blur="submit" e-name="description">{{model.description}}</a>
            </div>
            <div class="col-xs-2">
                <label>P.O #:</label>
            </div>
            <div class="col-xs-3">
                <a href="#" editable-text="model.poNumber" buttons="no" blur="submit" e-name="poNumber">{{model.poNumber}}</a>                
            </div>
        </div>
        <div class="row">
            <div class="col-xs-2">
                <label>Model #:</label>
            </div>
            <div class="col-xs-5">
                <a href="#" editable-text="model.modelNumber" buttons="no" blur="submit" e-name="model">{{model.modelNumber}}</a>
            </div>
            <div class="col-xs-2">
                <label>Procedure:</label>
            </div>
            <div class="col-xs-3">
                <!--<a href="#" editable-text="model.procedure" buttons="no" blur="submit" e-name="procedure">{{model.procedure}}</a>-->
                
                <span e-typeahead="item as item.procedureName for item in getProcedureList($viewValue)" e-typeahead-editable="false"
                      onaftersave="updateProcedure($data)" editable-text="model.procedure" buttons="no" blur="submit"><strong>{{model.procedure}}</strong></span>
            </div>
        </div>
        <div class="row">
            <div class="col-xs-2">
                <label>Serial #:</label>
            </div>
            <div class="col-xs-5">
                <a href="#" editable-text="model.serialNumber" buttons="no" blur="submit" e-name="serialNumber">{{model.serialNumber}}</a>
            </div>
            <div class="col-xs-2">
                <label>Asset #:</label>
            </div>
            <div class="col-xs-3">
                <a href="#" editable-text="model.assetNumber" buttons="no" blur="submit" e-name="assetNumber">{{model.assetNumber}}</a>
            </div>
        </div>
        <div class="row spacing-top-md">
            <div class="col-xs-2">
                <label>Condition Received:</label>
            </div>
            <div class="col-xs-5">
                <a href="#" e-ng-options="s.value as s.text for s in statuses" editable-select="model.conditionReceivedId" buttons="no" blur="submit" e-name="conditionReceivedId">
                    {{showStatus(model.conditionReceivedId)}}
                </a>
            </div>
            <div class="col-xs-2">
                <label>Calibration Cycle:</label>
            </div>
            <div class="col-xs-3">
                <a href="#" editable-select="model.calibrationCycle" buttons="no" blur="submit" e-ng-options="cycle.value as cycle.text for cycle in Cycles">{{model.calibrationCycle}} month<span ng-show="model.calibrationCycle">s</span></a>
            </div>
        </div>
        <div class="row">
            <div class="col-xs-2">
                <label>Condition Returned:</label>
            </div>
            <div class="col-xs-5">
                <a href="#" e-ng-options="s.value as s.text for s in statuses" editable-select="model.conditionReturnedId" buttons="no" blur="submit" e-name="conditionReturnedId">
                    {{showStatus(model.conditionReturnedId)}}
                </a>
            </div>
            <div class="col-xs-2">
                <label>Calibration date:</label>
            </div>
            <div class="col-xs-3">
                <a href="#" e-datepicker-popup="dd/MMM/yyyy" editable-bsdate="model.calibrationDate" buttons="no" blur="submit" e-name="calibrationDate">{{model.calibrationDate | date: 'dd/MMM/yyyy'}}</a>
            </div>
        </div>
        <div class="row">
            <div class="col-xs-2">
                <label>Temperature:</label>
            </div>
            <div class="col-xs-5">
                <a href="#" editable-number="model.temperature" buttons="no" blur="submit" e-name="temperature" e-step="0.1">
                    {{model.temperature}} <span ng-show="model.temperature">°C</span>
                </a>
            </div>
            <div class="col-xs-2">
                <label>Next Due Date:</label>
            </div>
            <div class="col-xs-3">
                <p class="form-control-static">{{model.nextDueDate | date: 'dd/MMM/yyyy'}}</p>
            </div>
        </div>
        <div class="row">
            <div class="col-xs-2">
                <label>Relative Humidity:</label>
            </div>
            <div class="col-xs-5">
                <a href="#" editable-number="model.relativeHumidity" buttons="no" blur="submit" e-name="relativeHumidity" e-step="0.1">
                    {{model.relativeHumidity}} <span ng-show="model.relativeHumidity">%</span>
                </a>
            </div>
            <div class="col-xs-2">
                <label>Certified By:</label>
            </div>
            <div class="col-xs-3">
                <p class="form-control-static">{{model.certifiedBy}}</p>
            </div>
        </div>

        <div class="row">
            <div class="col-xs-2">
                <label>Customer:</label>
            </div>
            <div class="col-xs-10">
                <a href="#" editable-text="model.customer.name" buttons="no" blur="submit" e-name="name" e-typeahead="customer as customer.name for customer in getCustomerList($viewValue)" e-typeahead-editable="false" onaftersave="updateCustomer($data)">
                    {{model.customer.name}}
                </a>
                <p class="form-control-static">{{model.customer.address}}
                    <span ng-if="model.customer.city">, {{model.customer.city}}</span>
                    <span ng-if="model.customer.state">, {{model.customer.state}}</span>
                    <span ng-if="model.customer.country">, {{model.customer.country}}</span>
                </p>                
            </div>
        </div>
    </div>

    <div class="row visible-print">
        <div class="col-xs-12 spacing-top-sm spacing-bottom-sm">
            <div class="term-of-calibration">
                This certifies that the above instrument was calibrated in compliance with the Calibration System Requirement of ISO/IEC 17025:2005 in accrdance with referenced procedures. Standards used to perform this calibration are certified by or traceable to NIST, natural physical constants, consensus standards or derived by the ratio type calibrations. Expanded uncertainties are determine as required with a distribution that corresponds to a probability of approximately 95% (2 sigma), no sampling plan or other process was used for this calibration, the results reported herein apply only to the calibration of item described above.
                All calibrations are performed to manufacturer's specifications, unless otherwise noted. Customer has been contacted concerning re-certification interval and documentation has been received and is on file. This form shall be reproduced, except in full, without the expressed written consent of Kim Long Survey JSC.
            </div>
        </div>
    </div>

</div>
<h4 class="text-center">
    Standard utilized
</h4>
<div class="min-height: 80px;">
    <table class="table">
        <thead>
            <tr>
                <th class="col-xs-2">Standard#</th>
                <th class="col-xs-3">Manufacturer</th>
                <th class="col-xs-2">Model#</th>
                <th class="col-xs-1">Due Date</th>
                <th class="col-xs-1">Report#</th>
                <th class="hidden-print" style="width:7%;"></th>
            </tr>
        </thead>
        <tbody>
            <tr ng-repeat="item in model.standards">
                <td>
                    <p tabindex="0" editable-text="item.standardNo" e-name="number" e-form="rowform" e-required>
                        {{item.standardNo}}
                    </p>
                </td>
                <td>
                    <p tabindex="0" editable-text="item.manufacturer" e-name="manufacturer" e-form="rowform" e-required>
                        {{item.manufacturer}}
                    </p>
                </td>
                <td>
                    <p tabindex="0" editable-text="item.modelNumber" e-name="modelNumber" e-form="rowform" e-required>
                        {{item.modelNumber}}
                    </p>
                </td>
                <td>
                    <p e-datepicker-popup="dd/MMM/yyyy" editable-bsdate="item.dueDate" e-name="dueDate" e-form="rowform" e-required>
                        {{item.dueDate | date: 'dd/MMM/yyyy'}}
                    </p>
                </td>
                <td>
                    <p tabindex="0" editable-text="item.testReportNumber" e-name="testReportNumber" e-form="rowform" e-required>
                        {{item.testReportNumber}}
                    </p>
                </td>
                <td class="hidden-print">
                    <form editable-form name="rowform" onbeforesave="saveUser($data, user.id)" ng-show="rowform.$visible" class="form-buttons form-inline">
                        <button type="submit" ng-disabled="rowform.$waiting || rowform.$invalid" class="btn btn-primary btn-sm">
                            <b class="glyphicon glyphicon-ok"></b>
                        </button>
                        <button type="button" ng-disabled="rowform.$waiting" ng-click="rowform.$cancel()" class="btn btn-default btn-sm">
                            <b class="glyphicon glyphicon-remove"></b>
                        </button>
                    </form>
                    <button ng-show="!rowform.$visible" class="btn btn-primary btn-sm" ng-click="rowform.$show()">
                        <b class="glyphicon glyphicon-edit"></b>
                    </button>
                    <button class="btn btn-danger btn-sm" ng-click="removeRow($index)">
                        <b class="glyphicon glyphicon-trash"></b>
                    </button>
                </td>
            </tr>
            <tr class="hidden-print">
                <td>
                    <input typeahead="standard as standard.standardNo for standard in getStandardList($viewValue)" typeahead-editable="false" form="newRowForm" name="standardNo" ng-model="newRow" type="text" class="form-control" required />
                </td>
                <td>
                    <span class="form-control-static">{{newRow.manufacturer}}</span>
                </td>
                <td>
                    <span class="form-control-static">{{newRow.modelNumber}}</span>
                </td>
                <td>
                    <span class="form-control-static">{{newRow.dueDate | date: 'dd/MMM/yyyy'}}</span>
                </td>
                <td>
                    <span class="form-control-static">{{newRow.testReportNumber}}</span>
                </td>
                <td>
                    <form name="newRowForm" id="newRowForm" novalidate>
                        <input form="newRowForm" name="standardNo" ng-model="newRow.standardNo" hidden type="text" class="form-control" required />
                        <button class="btn btn-primary btn-sm" ng-click="addRow(newRow)" ng-disabled="newRowForm.$invalid">
                            <b class="glyphicon glyphicon-plus"></b>
                        </button>
                    </form>
                </td>
            </tr>
        </tbody>
    </table>
</div>
<div class="row" style="min-height: 82px;">
    <div class="col-xs-5 col-sm-3 print-expand">
        <label style="margin-top: 10px;">Special Remarks or Requirements:</label>
    </div>
    <div class="col-xs-7 col-sm-9 print-collapse">
        <a tabindex="0" editable-textarea="model.remarks" e-rows="2" buttons="no" blur="submit" e-style="margin-top: 10px;">
            <pre>{{model.remarks}}</pre>
        </a>
    </div>
</div>
<page-footer page="pageNumber" standard="KC-390.1 - Form Date: Jan/2014">
    <div class="row visible-print spacing-bottom-sm" style="width:95%;">
        <div class="col-xs-2">
            <label>Signature or Stamp:</label>
        </div>
        <div class="col-xs-2">
            <div style="border-bottom: 1px dotted #999; width: 90%;">&nbsp;</div>
        </div>
        <div class="col-xs-2">
            <label>Signature or Stamp:</label>
        </div>
        <div class="col-xs-2">
            <div style="border-bottom: 1px dotted #999; width: 90%;">&nbsp;</div>
        </div>
        <div class="col-xs-2">
            <label>Signature or Stamp:</label>
        </div>
        <div class="col-xs-2">
            <div style="border-bottom: 1px dotted #999; width: 90%;">&nbsp;</div>
        </div>
    </div>
    <div class="row" style="width:95%;">
        <div class="col-xs-2">
            <label>Technician:</label>
        </div>
        <div class="col-xs-2 text-center">
            <a href="#" editable-text="model.technician" buttons="no" blur="submit" e-name="technician">{{model.technician}}</a>
        </div>
        <div class="col-xs-2">
            <label>Quality Inspector:</label>
        </div>
        <div class="col-xs-2 text-center">
            <a href="#" editable-text="model.inspector" buttons="no" blur="submit" e-name="inspector">{{model.inspector}}</a>
        </div>
        <div class="col-xs-2">
            <label>Approved by:</label>
        </div>
        <div class="col-xs-2 text-center">
            <a href="#" editable-text="model.approvedBy" buttons="no" blur="submit" e-name="approvedBy">{{model.approvedBy}}</a>
        </div>
    </div>
</page-footer>
<nav class="navbar navbar-default navbar-fixed-bottom navbar-inverse" role="navigation">
    <div class="container">
        <button class="btn btn-warning navbar-btn" ng-click="back()">Back</button>
        <!--<a class="btn btn-info navbar-btn" disabled href="">Next</a>-->
        <button class="btn btn-warning navbar-btn pull-right" busy-click="remove(model)" success="Deleted successfully" has-access="CertificateDelete" ng-show="model.certificateId">Delete</button>
        <button class="btn btn-info navbar-btn" ng-show="model.certificateId" ng-click="copy()" has-access="CertificateCreate">Copy</button>
        <button class="btn btn-info navbar-btn" ng-show="model.certificateId" busy-click="update(model)" has-access="CertificateEdit" success="Updated successfully">Update</button>
        <button class="btn btn-info navbar-btn" ng-hide="model.certificateId" busy-click="save(model)" has-access="CertificateCreate" success="Created successfully">Save</button>
        <button class="btn btn-info navbar-btn" ng-show="model.certificateId" ng-click="doPrint()"><i class="glyphicon glyphicon-print"></i> Print</button>
    </div>
</nav>
